<#include "../base.ftl"/>
<#macro cssfile>
</#macro>

<#macro scriptfile>
</#macro>

<#macro breadcrumb>
	<ul class="breadcrumb">
	  <#include "../index-menu.ftl"/>
	 <li class="active">信息沟通</li>
	</ul>
</#macro>

<#macro title>
广大物流云平台
</#macro>
<#macro jsscript>
//function initJqGridHideDtlBtn(){
//	$("#add_gridSchedulingDtlTable").hide();
//}
function setBeanName(params,postdata){
	var shippingId = $("#gridTable").jqGrid("getGridParam", "selrow");
	var applicant = $("#gridTable").jqGrid("getGridParam", "selrow");
	//alert(shippingId);
	var add_data=new Object();
	add_data["shippingId"]= "el:terminalpredefine.SHIPPING_ID";
	add_data["applicant"]= "el:currUser.userId";
	add_data["status"]='1';
	//add_data["beanName"] = "tsm.TsmSms";
	return add_data;
}

$(function(){
  $("#gridSchedulingDtlTable").jqGrid({
  //list表格获取地址
      //list表格数据获取地址
      url:'${request.contextPath}/list/mainConsole/TsmSms/list.html',
      //list表格编辑地址
      editurl :'${request.contextPath}/operator/tsm/TsmSms/operator.html',
      datatype: "json",
      mtype:"POST",
      height: 400,
      colNames:['SMS编号','申请人','船舶编号','信息内容','申请日期','说明','计划发送时间','实际发送时间','状态','创建人','创建日期','最后修改人','最后修改时间'],
      colModel:[
          {name:'smsId',jsonmap:'SMS_ID',index:'SMS_ID',editable:false,hidden:true},          
          {name:'applicant',jsonmap:'APPLICANT',index:'APPLICANT',align:'center',editable:false,editrules:{required:true}},     
          {name:'shippingId',jsonmap:'SHIPPING_ID',index:'SHIPPING_ID',editable:false,hidden:true},
          {name:'content',jsonmap:'CONTENT',index:'CONTENT',align:'center',edittype:'textarea',editable:true,editrules:{required:true}},
          {name:'applyDate',jsonmap:'APPLY_DATE',index:'APPLY_DATE',align:'center',editable:true,editrules:{required:true},
        	  formatter : 'date',
	          formatoptions : {srcformat : 'Y/m/d',newformat : 'Y-m-d'},
              editoptions :  {dataInit: function(element) {
                $(element).datepicker({changeMonth : true,changeYear : true,changeDate:true,dateFormat : 'yy-mm-dd'});
            }}     
        },   
          {name:'remark',jsonmap:'REMARK',index:'REMARK',align:'center',editable:true,editrules:{required:true}},
          {name:"planSendTime",jsonmap:"PLAN_SEND_TIME",editable:false,index:"PLAN_SEND_TIME",hidden:false,
        	  formatter : 'date',
	          formatoptions : {srcformat : 'Y/m/d',newformat : 'Y-m-d'},
              editoptions :  {dataInit: function(element) {
              $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
          }}   
          },
          {name:'realSendTime',jsonmap:'REAL_SEND_TIME',editable:false,index:'REAL_SEND_TIME',hidden:true,
        	  formatter : 'date',
	          formatoptions : {srcformat : 'Y/m/d',newformat : 'Y-m-d'},
	          editoptions :  {dataInit: function(element) {
              $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
          }}    
          },

          {name:'status',jsonmap:'STATUS',index:'STATUS',editable:false,hidden:true},
          {name:'createdBy',jsonmap:'CREATED_BY',editable:false,hidden:true},
          {name:'createdDate',jsonmap:'CREATED_DATE',editable:false,hidden:true,
        	  formatter : 'date',
	          formatoptions : {srcformat : 'Y/m/d',newformat : 'Y-m-d'},
              editoptions :  {dataInit: function(element) {
                  $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
              }}       
          },
          {name:'lastUpdBy',jsonmap:'LAST_UPD_BY',editable:false,hidden:true},
          {name:'lastUpdDate',jsonmap:'LAST_UPD_DATE',editable:false,hidden:true,
        	  formatter : 'date',
	          formatoptions : {srcformat : 'Y/m/d',newformat : 'Y-m-d'},
	          editoptions :  {dataInit: function(element) {
                  $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
              }}  
          }     
      ],
      sortname:'LAST_UPD_DATE',
      sortorder:'desc',
      viewrecords : true,
      gridview : true,
      rownumbers : true,
      autowidth : true,
      rowNum : 20,
      rowList : [10,20,30],
      //onSelectRow:cellSelect,
      jsonReader : {
          page : "page.pageNo",
          total : "page.totalPages",
          records : "page.totalCount",
          root : "page.result",
          repeatitems : false,
          id : 'SMS_ID'
      },
      
      prmNames : {
          rows : "page.pageSize",
          page : "page.pageNo",
          sort : "page.orderBy",
          order : "page.order"
      },
      
      pager : "#gridSchedulingDtlPager",
      caption : "信息列表"
  }).navGrid("#gridSchedulingDtlPager",{
          edit:false,
          //editfunc:editSelect,
          add:true, 
          //addfunc:addVoyage,
          del:false, 
          //delfunc:selectDel,
          search: false
  },{ 
      //edit
      //beforeSubmit:cellSelect,
      reloadAfterSubmit:true,
      closeAfterEdit:true,//新增完毕后关闭
      afterComplete:opertaionPrompt,//更新结束后提示信息
      //onclickSubmit: setBeanName  //触发的事件
  },{
  //add
//	  beforeSubmit:beforeSubmit,
      reloadAfterSubmit : true,
      closeAfterAdd : true, //新增完毕后关闭
      afterComplete : opertaionPrompt,
      onclickSubmit: setBeanName
  },{
    //del
      reloadAfterSubmit : true, 
      closeAfterEdit : true,  //修改完毕后关闭
      afterComplete : opertaionPrompt, //更新结束后提示信息
      //onclickSubmit: fillCategoryId,    
      
  });
  //提交前的验证，检验数据，并加入beanName
  function validateSumbit(postdata, formid){
      return [true,''];
  }
});

</#macro>
<#macro main>
		<table id="gridSchedulingDtlTable"></table>
		<div id="gridSchedulingDtlPager"></div>
</#macro>
